<?

/* DefaultController controller class.
 * This class contains the handling code, divided into action methods.
 *
 */ 
class DefaultController extends AGController
{
  function __construct($ctrName) 
  {
    parent::__construct($ctrName);
    // your constructor code goes here
    
  }

  function Index()
  {
    $this->invokeModel();
    $this->invitations = $this->model->getOpenInvitations($this->user);
    $this->partyCountDS = DB_GetDatasetWQuery('SELECT count(*) FROM '.getTableName('parties').'
      WHERE p_party="'.$this->user->localRecord['u_key'].'"');
    $this->partyCount = $this->partyCountDS['count(*)'];
    $this->news = DB_GetList('SELECT * FROM '.getTableName('news').' WHERE
      1
      ORDER BY n_date DESC
      LIMIT 10
      ');
    if ($_REQUEST['ads'] != '')
    {
      if ($_REQUEST['ads'] == 'hide')
      {
        $this->user->localRecord['u_showads'] = 'N';
        $this->banner = 'You have killed all advertisements! They\'re gone. Dead.
          We won\'t show you any, ever again. (<a href="?ads=show">click here to undo</a>)';
      }
      else
      {
        $this->user->localRecord['u_showads'] = 'Y';
      }
      AdminNotify('Ads: '.$this->user->localRecord['u_showads'].' for '.$this->user->localRecord['u_fb_name'], '');
      DB_UpdateDataset('users', $this->user->localRecord);
    }
  }
  
  function Debug()
  {
  
  }
}


?>
